package com.learn.kafka;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;

/**
 * Kafka 消息生产者
 *
 * @Author: cong zhi
 * @CreateDate: 2021/3/2 15:37
 * @UpdateUser: cong zhi
 * @UpdateDate: 2021/3/2 15:37
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
@Component
public class KafkaProducer {

    /**
     * producer api
     */
    @Autowired
    private KafkaTemplate<Integer, String> kafkaTemplate;


    public void sendMessage() {
        kafkaTemplate.send("test", 1, "msgData");
    }

}
